/*
 * Filename:    HcpmsWarnDAOImpl.java
 * Copyright:   2014 中国平安保险（集团）股份有限公司 版权所有
 * Company:     平安科技养老险及健康险系统开发部
 * Create at:   2014年11月5日
 */
package com.paic.mhis.hcpms.warning.intergration.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.paic.mhis.hcpms.warning.dto.HcpmsCodeListDTO;
import com.paic.mhis.hcpms.warning.dto.HcpmsWarnProcessInfoDTO;
import com.paic.mhis.hcpms.warning.dto.HcpmsWarnRalationDTO;
import com.paic.mhis.hcpms.warning.dto.HcpmsWarnScreenDTO;
import com.paic.mhis.hcpms.warning.dto.HcpmsWarnTargetDTO;
import com.paic.mhis.hcpms.warning.dto.HcpmsWarningDTO;
import com.paic.mhis.hcpms.warning.dto.HcpmsWarnsDTO;
import com.paic.mhis.hcpms.warning.dto.WarnResultDTO;
import com.paic.mhis.hcpms.warning.dto.WarnResultDetailDTO;
import com.paic.mhis.hcpms.warning.dto.WarningCheckDTO;
import com.paic.mhis.hcpms.warning.dto.WarningCheckDetailDTO;
import com.paic.mhis.hcpms.warning.dto.WarningMedicalDTO;
import com.paic.mhis.hcpms.warning.dto.WarningResultAuditDTO;
import com.paic.mhis.hcpms.warning.intergration.dao.HcpmsWarnDAO;
import com.paic.pafa.biz.dao.BaseDAO;

@Component("hcpmsWarnDao")
public class HcpmsWarnDAOImpl extends BaseDAO implements HcpmsWarnDAO {

	@Override
	public List<HcpmsCodeListDTO> getCodeList(Map<String, Object> map) {
		List<HcpmsCodeListDTO> list = (List<HcpmsCodeListDTO>) this._queryForList("warning.getHcpmsCodeList", map);
		return list;
	}

	@Override
	public String createWarnNo(String businessType) {

		return this._getString("warning.createWarningTaskNo", businessType);
	}

	@Override
	public List<HcpmsWarnScreenDTO> getWarnScreenList(Map<String, Object> map) {

		return (List<HcpmsWarnScreenDTO>) this._queryForList("warning.getWarnScreenList", map);
	}

	@Override
	public void createHcpmsWarn(HcpmsWarningDTO warning) {
		this._insert("warning.insertHcpmsWarning", warning);
	}

	@Override
	public void createHcpmsWarnTarget(HcpmsWarnTargetDTO dto) {
		this._insert("warning.insertHcpmsWarnTarget", dto);

	}

	@Override
	public void createHcpmsWarnScreen(HcpmsWarnScreenDTO dto) {
		this._insert("warning.insertHcpmsWarnScreen", dto);

	}

	@Override
	public void updateHcpmsWarn(HcpmsWarningDTO warning) {
		this._update("warning.updateHcpmsWarning", warning);
	}

	@Override
	public void updateHcpmsWarnScreen(Map<String, Object> map) {
		this._update("warning.updateHcpmsWarnScreen", map);

	}

	@Override
	public void updateHcpmsWarnTarget(Map<String, Object> map) {
		this._update("warning.updateHcpmsWarnTarget", map);
	}

	@Override
	public String getgetHcpmsWarnTarget(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return this._getString("warning.getHcpmsTarget", map);
	}

	@Override
	public List<WarningCheckDetailDTO> getFeedBackDetailList(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return (List<WarningCheckDetailDTO>) this._list("warning.getFeedBackDetail", map);
	}

	@Override
	public WarningCheckDTO getFeedBackList(Map<String, Object> map) {
		// TODO Auto-generated method stub
		List<WarningCheckDTO> list = (List<WarningCheckDTO>) this._list("warning.getFeedBack", map);
		if (list.size() > 0)
			return list.get(0);
		else
			return null;
	}

	@Override
	public HcpmsWarnsDTO getWarningInfo(Map<String, Object> map) {

		return (HcpmsWarnsDTO) this._queryForObject("warning.getWarningInfo", map);
	}

	@Override
	public List<WarningMedicalDTO> getWarnMedicalList(Map<String, Object> map) {
		return (List<WarningMedicalDTO>) this._queryForList("warning.getWarnMedicalList", map);
	}

	@Override
	public List<HcpmsWarnRalationDTO> getWarnStaffList(Map<String, Object> map) {
		return (List<HcpmsWarnRalationDTO>) this._queryForList("warning.getWarnStaffList", map);
	}

	@Override
	public List<HcpmsWarnRalationDTO> getWarnInsuranceList(Map<String, Object> map) {
		return (List<HcpmsWarnRalationDTO>) this._queryForList("warning.getWarnInsuranceList", map);
	}

	@Override
	public int getMedicalListCount(Map<String, Object> map) {

		return this._getInt("warning.getMedicalListCount", map);
	}

	@Override
	public List<WarningMedicalDTO> getMedicalList(Map<String, Object> map) {
		List<WarningMedicalDTO> list = (List<WarningMedicalDTO>) this._queryForList("warning.getMedicalList", map);
		return list;
	}

	@Override
	public int getInsuranceListCount(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return this._getInt("warning.getInsuranceListCount", map);
	}

	@Override
	public List<HcpmsWarnRalationDTO> getInsuranceList(Map<String, Object> map) {
		List<HcpmsWarnRalationDTO> list = (List<HcpmsWarnRalationDTO>) this._queryForList("warning.getInsuranceList",
				map);
		return list;
	}

	@Override
	public List<HcpmsWarnRalationDTO> getStaffList(Map<String, Object> map) {
		List<HcpmsWarnRalationDTO> list = (List<HcpmsWarnRalationDTO>) this._queryForList("warning.getStaffList", map);
		return list;
	}

	@Override
	public void warningChangeAudit(String warnNo) {
		this._insert("warning.warningChangeAuditBase", warnNo);
		this._insert("warning.warningChangeAuditTarget", warnNo);
	}

	@Override
	public void saveAssessResultDetail(WarnResultDetailDTO dto) {
		this._insert("warning.insertAssessResultDetail", dto);
	}

	@Override
	public void updateAssessResultDetail(Map<String, Object> map) {
		this._update("warning.updateAssessResultDetail", map);
	}

	@Override
	public void updateAssessResult(WarnResultDTO dto) {
		this._update("warning.updateAssessResult", dto);
	}

	@Override
	public void saveAssessResult(WarnResultDTO dto) {
		this._insert("warning.insertAssessResult", dto);
	}

	@Override
	public void saveWarnResultAudit(WarningResultAuditDTO dto) {
		this._insert("warning.insertResultAudit", dto);
	}

	@Override
	public void updateWarnResultAudit(WarningResultAuditDTO dto) {
		this._update("warning.updateResultAudit", dto);
	}

	@Override
	public WarningResultAuditDTO getAuditResult(Map<String, Object> map) {
		List<WarningResultAuditDTO> list = (List<WarningResultAuditDTO>) this._queryForList("warning.getExamineResult",
				map);
		if (list.size() > 0)
			return list.get(0);
		return null;
	}

	@Override
	public WarnResultDTO getWarnResult(Map<String, Object> map) {
		List<WarnResultDTO> list = (List<WarnResultDTO>) this._queryForList("warningResultQuery", map.get("warnNo"));
		if (list.size() > 0)
			return list.get(0);
		return null;
	}

	@Override
	public List<WarnResultDetailDTO> getWarnResultList(Map<String, Object> map) {
		return (List<WarnResultDetailDTO>) this._queryForList("warningResultQueryDetail", map.get("warnNo"));
	}

	@Override
	public String checkWarnNoBiz(String warnNoBiz) {
		return this._getString("warning.checkWarnNoBiz", warnNoBiz);
	}

	/**
	 * 预警通知单号
	 */
	@Override
	public String createWarnNoticeNum() {
		return this._getString("warning.createWarnNoticeNum", "");
	}

	@Override
	public void deleteUpNodeDate(Map<String, Object> map) {
		this._update("warning.deleteUpNodeDate", map);
	}
	
	
	/**
	 * 流程信息查看
	 * @param map
	 * @return
	 */
	@Override
	public List<HcpmsWarnProcessInfoDTO> getAllWorkFlowInfo(
			Map<String, Object> map) {
		return (List<HcpmsWarnProcessInfoDTO>) this._queryForList("warning.queryAllWorkFlowInfo", map);
	}
    /**
     * 流程状态信息查看
     */
	@Override
	public String queryProcessStatusInfo(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return this._getString("warning.queryProcessStatusInfo", map);
	}


}
